<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--    用法-->
    <!--    axios.get(地址?key1=value1&key2=value2).then(function(response){},function(err){})-->
    <!--    axios.post(地址,{key1:value1,key2:value2}).then(function(response){},function(err){})-->
</head>
<body>
    <input type="button" value="get" class="get">
    <input type="button" value="post" class="post">
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script>
        // 获取class是get的按钮
        document.querySelector('.get').onclick = function () {
            axios.get('https://autumnfish.cn/api/joke/list?num=6')
                .then(function(response){
                console.log(response);
            },function (err) {
                    console.log(err);
                })
        };
        document.querySelector('.post').onclick = function () {
            axios.post('https://autumnfish.cn/api/user/reg',{username:'董sere舒服'})
                .then(function(response){
                console.log(response);
            },function (err) {
                    console.log(err);
                })
        };
    </script>
</body>
</html>